Trade Filters





Kerry Back

Workflow

  • Positions spreadsheet (initially all zero)
  • Ranks spreadsheet (from train and predict)
  • Prices spreadsheet (most recent stock prices)
  • (Positions + Ranks + Prices) \(\rightarrow\) Trades spreadsheet
  • (Positions + Trades) \(\rightarrow\) updated Positions spreadsheet

Setting up a long portfolio

  • Select desired number of stocks. Plan to equally weight (for example).

  • Spreadsheet 1: ranks of stocks (from train + predict)

  • Spreadsheet 2: up-to-date prices for stocks in universe

  • Spreadsheet 3:

    • current # shares (at start, = 0),
    • desired # shares (at start, = portfolio value \(\times\) desired weight / price)
    • trades to make (at start, = desired # shares)
  • Spreadsheet 4: shareholdings after trades

Monitoring a long portfolio

  • Update cash = cash + interest
  • New spreadsheet 1: ranks changed, no longer holding just top stocks
  • New spreadsheet 2: prices changed, no longer equally weighted
  • Need new spreadsheet 3: what trades to make?

First decision: what to sell

  • Sell all shares if new rank is too low
  • Sell some shares if rank is still high but new weight is too high

Second decision: what to buy

  • Cash = prior cash balance + proceeds from sales
  • Start with best stocks based on new ranking
    • If not holding, invest to target weight
    • If holding and weight < target, buy additional shares?

Coding goal

  • Read spreadsheets 4, 1 and 2
  • Compute spreadsheet 3 (desired trades)
  • Update spreadsheet 4 (holdings after trades)